<?php
namespace app\controllers;

use app\logic\CommonLogic;

class CommonController extends BaseController
{
    /**
     * 获取省市区
     * @apiDescription   by Jim
     * @api              {post} /common/get-area 获取省市区
     * @apiName          get-area
     * @apiVersion       1.0.0
     * @apiParam {int} parent_code 父级地区码，默认是0
     * @apiParam {int} level 级，默认是第1级
     * @apiGroup         Common
     * @apiSampleRequest /common/get-area?flagsign=1
     * @apiSuccessExample {json} 获取成功
     * [{
    "region_code":"***",     parent_id传该值
    "region_name":"***",
    "parent_code":"0",
    "level":1
    }]
     * @apiError         77777    获取失败
     */
	public function actionGetArea()
	{
        $parent_code = $this->getQueryparams('parent_code',0);
        $level = $this->getQueryparams('level',1);
	    $commonLogic = new CommonLogic();
        $area = $commonLogic->getArea($parent_code,$level);
        $this->response($area);
	}



}